//1.装包yarn add vue-router@3.5.3
//2.在main.js 中引入 VueRouter构造函数
import VueRouter from 'vue-router'
import Vue from 'vue'
//导入组件
import Find from '../views/Find'
import My from '../views/My'
import Part from '../views/Part'
import Error from '../views/Error'
//导入组件
import Reconmmend from '../views/Second/Reconmmend'
import Ranking from '../views/Second/Ranking'
import SongList from '../views/Second/SongList'


//安装插件-帮我们注册全局组件 router-view router-link
Vue.use(VueRouter)

const router =new VueRouter({
   routes:[{
    path:'/',
    redirect:'/find'
   },
    {
      path:'/find',
      component:Find,
      children:[
       
        {path:"recommend",
         component:Reconmmend},
      {path:"ranking",
      component:Ranking
      },
      {path:"songlist",
      component:SongList}
      ]
    },
     {
      path:'/my',
      component:My
    },
     {
      path:'/part/:name',
      component:Part
    },
    {
      path:'*',
      component:Error
    }
    
  ]
})

export default router
